﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        User user = new User();
        OleDbDataReader dr = user.GetUserLogin(tbUid.Text.Trim(),tbPwd.Text.Trim());
        bool isLogin = false;
        if (dr.Read())
        {
            Session["UID"] = dr["UID"].ToString();
            Session["UNAME"] = dr["UNAME"].ToString();
            Session["EMPID"] = dr["EMPID"].ToString();
            Session["Upro"] = Convert.ToInt32(dr["Upro"].ToString());
            isLogin = true;
        }
        else
        { SystemTools.PopMsg("UID OR PASS ERROR"); }
        dr.Close();
        if (isLogin)
        { Response.Redirect("default.aspx"); }
    }
}
